package com.lucy.viewer.config;

import com.lucy.viewer.service.DefaultViewerAuthServiceImpl;
import com.lucy.viewer.service.ViewerAuthService;
import com.lucy.viewer.service.ViewerFileService;
import com.lucy.viewer.service.impl.DefaultViewerFileServiceImpl;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;

/**
 * @author kindear
 * 基础服务实现
 */
@SpringBootConfiguration
public class ViewerServiceConfig {
    // 默认预览方式选择
    @Bean
    @ConditionalOnMissingBean(value = PreviewModeConfig.class)
    public PreviewModeConfig previewModeConfig(){
        return new DefaultPreviewModeConfig();
    }

    // 默认编辑方式选择
    @Bean
    @ConditionalOnMissingBean(value = EditModeConfig.class)
    public EditModeConfig editModeConfig(){
        return new DefaultEditModeConfig();
    }

    @Bean
    @ConditionalOnMissingBean(value = ViewerFileService.class)
    public ViewerFileService viewerFileService(){
        return new DefaultViewerFileServiceImpl();
    }

    @Bean
    @ConditionalOnMissingBean(value = ViewerAuthService.class)
    public ViewerAuthService viewerAuthService(){
        return new DefaultViewerAuthServiceImpl();
    }
}
